import {link} from "@/api/api.js"
export let xiangqing={
    state:{
        arr:{},
        id:0
    },
    mutations:{
       
        arrx2(state,payload){
            state.id=payload
            // console.log(state.id)
        },
        arrx(state,payload){
            state.arr=payload[0]
            // console.log(state.arr)
        }
    },  
    actions:{
        xiangqingdata({state,commit}){
            link("/user/xq","get").then((ok)=>{
                console.log(ok.data)
                let newarr=ok.data.filter((v)=>{
                    if(v.id==state.id){
                        return v
                    }
                })
                commit("arrx",newarr)
                // console.log(ok.data)
                // console.log(state.id)
            })
        }
    }
}